//
//  SHCreditFooter.m
//  JiFengDaRen
//
//  Created by SH_iOS on 2017/11/30.
//  Copyright © 2017年 SH_iOS. All rights reserved.
//

#import "SHCreditFooterCell.h"
@interface SHCreditFooterCell()

@end
@implementation SHCreditFooterCell

-  (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{

    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        self.backgroundColor = KBASEBGCOLOR;
        self.selectionStyle = UITableViewCellSelectionStyleNone;

        [self.changeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.mas_equalTo(self);
            make.centerY.mas_equalTo(self);
        }];
    }


    return self;
}



- (SHButton *)changeBtn{
    
    if(!_changeBtn){
        _changeBtn = [SHButton buttonWithType:UIButtonTypeCustom title:@"" font:15 titleColor:[UIColor whiteColor] textAlignment:0 forState:UIControlStateNormal];
        [_changeBtn setBackgroundImage:[UIImage imageNamed:@"btn_bg"] forState:UIControlStateNormal];
        _changeBtn.titleLabel.font = KSystemFont(16);
        [_changeBtn setTitleColor:KSHTEXTCOLOR forState:UIControlStateNormal];
        _changeBtn.userInteractionEnabled = YES;

        [_changeBtn addTarget:self action:@selector(changeCardBtnAction:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:_changeBtn];
        
    }
    return _changeBtn;
    
    
}
- (void)changeCardBtnAction:(SHButton *)sender{
    
    if ([_delegate respondsToSelector:@selector(changeFooter:changeCardBtn:)]) {
        [_delegate changeFooter:self changeCardBtn:sender];
        
    }
    
    
}
- (void)setButtonTitle:(NSString *)buttonTitle{
    
    _buttonTitle = buttonTitle;
    [_changeBtn setTitle:buttonTitle forState:UIControlStateNormal];
}

- (void)setIsClickedBtn:(BOOL)isClickedBtn{
    
    if (isClickedBtn) {
//        _changeBtn.backgroundColor = KREDCOLOR;
        _changeBtn.userInteractionEnabled = YES;
        
    }else{
//        _changeBtn.backgroundColor = [UIColor colorWithWhite:208.f/255 alpha:1];
        _changeBtn.userInteractionEnabled = NO;
        
    }
    
}



@end
